<%+header%>

<%
	local uci = require("luci.model.uci").cursor()
	local sys = require "luci.sys"
	local ifaces = sys.net:devices()
	local net = require "luci.model.network".init()
%>

<script type="text/javascript" src="<%=resource%>/cbi.js?v=git-18.193.28471-ee087a1"></script>
<script type="text/javascript">//<![CDATA[
    var stxhr = new XHR();

    function update_connections()
    {
	var ec = document.getElementById('connections');

	if (ec)
	{
	    ec.innerHTML =
		'<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" /> ' + '<%:Waiting for command to complete...%>'
	    ;

	    stxhr.post('<%=url('admin/network/mptcp')%>/mptcp_connections_data/', { token: '<%=token%>' },
		function(x)
		{
		    if (x.responseText)
		    {
			ec.innerHTML = String.format('<pre>%s</pre>', x.responseText );
		    } else {
			ec.innerHTML = '<pre><%:Error%></pre>';
		    }
		}
	    );
	}
    }
    setInterval(function () {
	update_connections();
    }, 10000);
//]]></script>

<% if stderr and #stderr > 0 then %><pre class="error"><%=pcdata(stderr)%></pre><% end %>
<div class="cbi-section">
    <span id="connections"></span>
    <script type="text/javascript">//<![CDATA[
	update_connections();
    //]]></script>
</div>
<%+footer%>
